<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>
        小程序商城管理平台        </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../css/x-admin.css" media="all">
</head>
<style>
    .black_overlay{
        display: none;
        position: absolute;
        top: 0%;
        left: 0%;
        width: 100%;
        height: 100%;
        background-color: black;
        z-index:1001;
        -moz-opacity: 0.8;
        opacity:.80;
        filter: alpha(opacity=88);
    }
    .white_content {
        display: none;
        position: absolute;
        top: 25%;
        left: 25%;
        width: 25%;
        height: 55%;
        padding: 20px;
        border: 10px solid lightskyblue;
        background-color: white;
        z-index:1002;
        overflow: auto;
    }
    #light{
        line-height: 50px;
    }
    #menu{
        line-height: 50px;
    }
    #b{
        text-align: center;
    }
    #from{
        line-height: 20px;
    }
    #c{
        position:absolute;
        bottom:0;
        right:0;
    }
    #select{
        background: papayawhip;
    }
    #select1{
        background: papayawhip;
    }
</style>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header header header-demo">
        <div class="layui-main">
            <a class="logo" href="index.html">
                一站式商城管理平台
            </a>
            <ul class="layui-nav" lay-filter="">
                <li class="layui-nav-item"><img src="../images/logo.png" class="layui-circle" style="border: 2px solid #A9B7B7;" width="35px" alt=""></li>
                <li class="layui-nav-item">
                    <a href="javascript:;">admin</a>
                    <dl class="layui-nav-child"> <!-- 二级菜单 -->
                        <dd><a href="">个人中心</a></dd>
                        <dd><a href="../logout">退出</a></dd>
                    </dl>
                </li>
                <!-- <li class="layui-nav-item">
                  <a href="" title="消息">
                      <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
                  </a>
                  </li> -->
                <li class="layui-nav-item x-index"><a th:href="@{'../index'}">首页</a></li>
            </ul>
        </div>
    </div>
    <div class="layui-side layui-bg-black x-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe607;</i><cite>会员管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toUserList'}">
                                <cite>用户列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toAdminList'}">
                                <cite>管理员管理</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toRoleList'}">
                                <cite>角色管理</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../user/toNoteList'}">
                                <cite>短信管理</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe62d;</i><cite>商品管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toCommodityList'}">
                                <cite>商品列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toClassifyList'}">
                                <cite>商品分类</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toTradeTrademarkList'}">
                                <cite>品牌列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toMoldList'}">
                                <cite>商品类型</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toParameterList'}">
                                <cite>商品属性</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toPropertyList'}">
                                <cite>参数列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../commodity/toEvaluateList'}">
                                <cite>商品评价</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe634;</i><cite>订单管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../order/orderlist'}">
                                <cite>订单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../invoice/invoicelist'}">
                                <cite>发货单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../billoflading/BillListAll'}">
                                <cite>提货单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../aftersale/aftersalelist'}">
                                <cite>售后单列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../return/returnlist'}">
                                <cite>退货单列表</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe642;</i><cite>运营管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../Article/Articlelist'}">
                                <cite>文章列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../notice/noticelist'}">
                                <cite>公告列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../ArticleType/ArticleTypelist'}">
                                <cite>文章分类</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../Advertising/Advertisinglist'}">
                                <cite>广告列表</cite>
                            </a>
                        </dd>
                        </dd>
                        <dd class="">
                        <dd class="">
                            <a th:href="@{'../Advertisingspace/Advertisingspacelist'}">
                                <cite>广告位列表</cite>
                            </a>
                        </dd>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe630;</i><cite>促销管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../promotion/seckillList'}">
                                <cite>团购秒杀列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../coupon/couponList'}">
                                <cite>优惠券列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../sales/salesList'}">
                                <cite>促销列表</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe606;</i><cite>财务管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../paylist'}">
                                <cite>支付单列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../withdlist'}">
                                <cite>提现列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../metlist'}">
                                <cite>支付方式列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../retlist'}">
                                <cite>退款单列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../acclist'}">
                                <cite>账户资金管理</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe612;</i><cite>控制面板</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../explist'}">
                                <cite>导入导出</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../piclist'}">
                                <cite>图片列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../stolist'}">
                                <cite>门店列表</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../log/loglist'}">
                                <cite>操作日志</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../logisticsCompany/getLogistics'}">
                                <cite>物流公司列表</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a class="javascript:;" href="javascript:;">
                        <i class="layui-icon" style="top: 3px;">&#xe613;</i><cite>微信管理</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd class="">
                            <a th:href="@{'../official/getOfficial'}">
                                <cite>公众号配置</cite>
                            </a>
                        </dd>
                        <dd class="">
                            <a th:href="@{'../official/getApplet'}">
                                <cite>小程序配置</cite>
                            </a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>

    </div>
    <div class="layui-tab layui-tab-card site-demo-title x-main" lay-filter="x-tab" lay-allowclose="true">
        <div class="x-slide_left"></div>
        <!-- <ul class="layui-tab-title">
             <li class="layui-this">
                 我的桌面
                 <i class="layui-icon layui-unselect layui-tab-close"></i>
             </li>
         </ul>-->

        <div style="padding: 15px;">
            <div class="x-nav">
            <span class="layui-breadcrumb" style="visibility: visible;">
                <a href="">商品管理</a><span lay-separator="">/</span>
                <a href="">商品分类</a>
            </span>
                <a class="layui-btn layui-btn-primary" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                    <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
                </a>
            </div>
            <div class="layui-card-body ">
                <button class="layui-btn layui-btn-sm" type="button"  href = "javascript:void(0)" onclick = "openDialog()">新增</button>
            </div>
            <div class="table-body">
                <table class="layui-table layui-form">
                    <thead>
                    <tr>
                        <th></th>
                        <th>分类名称</th>
                        <th>父级分类</th>
                        <th>所属类型</th>
                        <th>LOGO</th>
                        <th>排序</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="list:${classifyList}">
                        <td th:text="${list.id}"></td>
                        <td th:text="${list.name}"></td>
                        <td th:text="${list.parentName}"></td>
                        <td th:text="${list.moldName}"></td>
                        <td><img th:src="@{'../../images/'+${list.LOGO}}" height="30" width="20"/></td>
                        <td th:text="${list.sorting}"></td>
                        <td class="td-manage">
                            <a title="编辑" th:href="@{'toClassifyUpdate?id='+${list.id}}">
                                <i class="layui-icon">&#xe642;</i></a>
                            <a title="删除" th:id="${list.id}" th:name="${list.parentId}" href="javascript:void(0);" onclick="del1(this)">
                                <i class="layui-icon">&#xe640;</i></a>
                            <span th:if="${list.parentId==0}">
                                <a title="新增分类" th:href="@{'toClassifyAddYM?id='+${list.id}}">
                                <i class="layui-icon">&#xe608;</i></a>
                            </span>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <div id="b">
                    <tr>
                <span th:if="${page.pageNo>1}">
                    <a class="layui-btn layui-btn-sm" th:href="@{'toClassifyList?no='+1}">首页</a>
                    <a class="layui-btn layui-btn-sm" th:href="@{'toClassifyList?no='+${page.pageNo-1}}">上一页</a>
                 </span>
                        <span th:if="${page.pageNo<page.pageSum}">
                    <a class="layui-btn layui-btn-sm" th:href="@{'toClassifyList?no='+${page.pageNo+1}}">下一页</a>
                    <a class="layui-btn layui-btn-sm" th:href="@{'toClassifyList?no='+${page.pageSum}}">末页</a>
                    </span>
                        第<span th:text="${page.pageNo}"></span>页/
                        共<span th:text="${page.pageSum}"></span>页
                        <span th:text="${page.count}"></span>条记录
                    </tr>
                </div>
            </div>
        </div>
    </div>
    <div class="site-mobile-shade">
    </div>
    <div id="light" class="white_content">
        <form action="toClassifyAdd" enctype="multipart/form-data" method="post" id="from">
            所属分类:&nbsp;<select name="parentId" class="layui-input" id="select1">
            <option value="0">请选择</option>
            <option value="-1">顶级分类</option>
            <option th:each="list:${classifyListByOne}" th:value="${list.id}"><span th:text="${list.name}"></span></option>
        </select>
            参数类型:&nbsp;<select name="moldId" class="layui-input" id="select">
            <option value="0">请选择</option>
            <option th:each="list:${moldList}" th:value="${list.id}"><span th:text="${list.name}"></span></option>
        </select>
            分类名称:&nbsp;<input type="text" name="name" id="name" placeholder="请输入分类名称" class="layui-input">
            &nbsp;<input type="file" name="files" id="LOGO"><br>
            LOGO:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <img class="layui-upload-img" src="../../images/default.png" id="image_src_logo" style="width:90px;height:90px;"><br/>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <button type="button" class="layui-btn" id="upload_img_logo" >上传图片</button><br/>
            排序:&nbsp;<input type="number" value="100" class="layui-input" name="sorting">
            <div class="layui-form-item" id="c">
                <button class="layui-btn layui-btn-sm" type="submit" id="modifyBtn">新增</button>
                <button class="layui-btn layui-btn-sm" type="button"  href = "javascript:void(0)" onclick = "closeDialog()">关闭</button>
            </div>
        </form>
    </div>

    <div id="fade" class="black_overlay"></div>
</div>
<script src="../lib/layui/layui.js" charset="utf-8"></script>
<script src="../js/x-admin.js"></script>
<script th:src="@{/webjars/jquery/3.3.1/jquery.min.js}"></script>
<script type="text/javascript">
    function openDialog(){
        document.getElementById('light').style.display='block';
        document.getElementById('fade').style.display='block';
    }
    function closeDialog(){
        document.getElementById('light').style.display='none';
        document.getElementById('fade').style.display='none';
    }
    function openMenu(){
        document.getElementById('menu').style.display='block';
        document.getElementById('fade').style.display='block';
    }
    function closeMenu(){
        document.getElementById('menu').style.display='none';
        document.getElementById('fade').style.display='none';
    }
    function del1(obj) {
        var id=$(obj).attr("id");
        var parentId=$(obj).attr("name");
       if(confirm("确实要删除吗？")){
           $.ajax({
               url:'chackParentId',
               data:"parentId="+id,
               async:false,
               dataType:'json',
               success:function(data){
                   if(data.checking=="exists"){
                       alert("该分类下还有其他分类不能进行删除哦!");
                       return false;
                   }else{
                       location.href='toClassifyDelete?id='+id;
                       alert("已删除");
                   }
               }
           });
        }else {
            alert("已经取消了删除操作");
        }
    }
    $(function () {
        $("#LOGO").hide();
        $("#upload_img_logo").click(function () {
            $("#LOGO").click();
        });
        $("#from").submit(function () {
            var parentId=$("[name=parentId]").val();
            var moldId=$("[name=moldId]").val();
            var name=$("[name=name]").val();
            var files=$("[name=files]").val();
            var sorting=$("[name=sorting]").val();
            if(parentId==0){
                alert("您还没有为您的商品选择所属分类哟!");
                return false;
            }else if(moldId==0){
                alert("您还没有为您的商品选择参数类型哟!");
                return false;
            }else if(name=="" || name==null){
                alert("您还没有为您的商品填写名称哟!");
                return false;
            }else if(files=="" || files==null){
                alert("您还没有为您的商品选择LOGO哟!");
                return false;
            }else if(sorting=="" || sorting==null){
                alert("您还没有为您的商品填写名称哟!");
                return false;
            }
        });
        $("[name=name]").blur(function () {
            var name=$("[name=name]").val();
            $.ajax({
                url:'chackClassifyName',
                data:"name="+name,
                async:false,
                dataType:'json',
                success:function(data){
                    if(data.checking=="exists"){
                        alert("该分类名已经被注册了哦!");
                        $("[name=name]").val("");
                    }
                }
            });
        })
    })
</script>
</body>
</html>
